<style scoped>
  .el-main {

  }

  .demo-table-expand {
    font-size: 0;
  }

  .demo-table-expand label {
    width: 90px;
    color: #1d00e6;
  }

  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 50%;
  }

  .a_margin_top {
    margin-top: 20px;
    /*overflow: hidden;*/
    margin-left: 10px;

  }

  .el-card__body {
    padding: 0px !important;
  }

  .H_V_center {
    display: flex;

    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    margin-left: 20px;
  }

  /*右上角状态*/
  .state {
    display: block;
    position: absolute;
    right: -18px;
    top: -60px;
    background: #c7c7c7;
    width: 140px;
    padding-top: 40px;
    text-align: center;
    color: #fff;
    font-size: 17px;
    -webkit-transform: rotateZ(45deg);
    -ms-transform: rotate(45deg);
    transform: rotateZ(45deg);
    -webkit-transform-origin: 77px 115px;
    -ms-transform-origin: 77px 115px;
    transform-origin: 77px 115px;
    z-index: 1;
  }

  /*角标标题样式*/
  .count {
    position: absolute;
    top: -10px;
    left: -10px;
    background-color: #409EFF;
    border-radius: 50%;
    color: #ffffff;
    display: inline-block;
    font-size: 12px;
    height: 26px;
    width: 26px;
    line-height: 26px;
    /*padding: 0 6px;*/
    text-align: center;
    white-space: nowrap;
    border: 1px solid #ffffff;
    z-index: 999;
  }

  /*标题样式*/
  .title_style {
    font-size: 1.25em;
    font-weight: 600;
    color: rgb(98, 113, 123);
  }

  /*时间样式*/
  .time_style {
    font-size: 1em;
    font-weight: 600;
    color: rgb(98, 113, 123);
  }

  /*时间文字样式*/
  .left_stl {
    font-size: 1em;
    color: rgb(98, 113, 123);
  }

  /*备注样式*/
  .comment_style {
    font-size: 1em;
    font-weight: 100;
    color: rgb(98, 113, 123);
  }

  /*文字上边距*/
  .margin_top {
    margin: 10px 0;
  }

  .el-loading-spinner {
    top: 40% !important;
  }

  .item {
    /*margin-top: 0px;*/
    margin-right: 40px;
  }


  .status >>> .el-badge__content.is-fixed {
    top: 12px;
  }

</style>
<template>
  <el-container>
    <el-header style="background-color: #fff">
      <el-row>
        <el-col :span="17" class="status">
          <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
            <el-menu-item index="1">
              <el-badge :value="achPatents.length+achProjects.length+achThesis.length" class="item"
                        :hidden="achPatents.length+achProjects.length+achThesis.length == 0">
                我的成果
              </el-badge>
            </el-menu-item>
            <el-menu-item index="2">
              <el-badge :value="examinetableData.length" class="item" :hidden="examinetableData.length == 0">
                待审核
              </el-badge>
            </el-menu-item>
            <el-menu-item index="3">
              <el-badge :value="AuditedtableData.length" class="item" :hidden="AuditedtableData.length == 0">
                已审核
              </el-badge>
            </el-menu-item>
            <el-button size="medium" plain style="margin-left: 30px" icon="el-icon-plus" @click="add">添加</el-button>
          </el-menu>
        </el-col>
        <el-col :span="5">
          <el-menu class="el-menu-demo" mode="horizontal">
            <el-menu-item>
              <div class="el-input el-input--medium el-input--prefix">
                <input type="text" autocomplete="off"
                       placeholder="请输入内容标题"
                       id="search_value"
                       ref="name" v-on:keyup="inputRef"
                       class="el-input__inner">
                <span class="el-input__prefix">
                  <i class="el-input__icon el-icon-search"></i>
                </span>
              </div>
            </el-menu-item>
          </el-menu>
        </el-col>
        <el-col :span="2">
          <el-menu class="el-menu-demo" mode="horizontal">
            <el-button type="primary" icon="el-icon-view" size="medium" style="margin-right: 20px" @click="search">搜索
            </el-button>
          </el-menu>
        </el-col>
      </el-row>
    </el-header>


    <el-main style="padding: 0 20px;" v-loading="loading">
      <div v-if="activeIndex === '1'">
        <el-collapse v-model="activeNames" accordion
                     v-if="achPatents.length>0||achProjects.length>0||achThesis.length>0">
          <el-collapse-item title="论文著作" name="1" v-if="achThesis.length!=0">
            <div v-for="(o ,index) in achThesis">
              <el-row class="a_margin_top">
                <el-col :span="24">
                  <div class="count">{{index+1}}</div><!--序号-->
                  <el-card shadow="hover" style="background-color: rgba(240,244,247,0.49);">
                    <el-row class="H_V_center">
                      <div class="state" v-if="o.state === '0'">未审核</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '1' && role < 2000 " style="background-color: #67C23A">
                        初审通过
                      </div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '1' && role >=2000 ">未审核</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '2'" style="background-color: red">复审通过</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '3'" style="background-color: red">通过</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '4'" style="background-color: #1b8fe5">退回</div><!--右上角三角状态-->
                      <el-col :span="19" style="margin: -10px 0px;">
                        <div class="margin_top">
                          <span class="title_style">标题：</span>
                          <span class="time_style">{{o.title}}</span>
                          <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                          <span class="left_stl">负责人：</span>
                          <span class="time_style">{{o.username}}</span>
                        </div>
                        <div class="margin_top">
                          <span class="left_stl">提交时间：</span>
                          <span class="time_style">{{dateFormat(o.createDate)}}</span>
                          <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                          <span class="left_stl" v-if="o.state!=='0'">审批时间：</span>
                          <span class="time_style" v-if="o.state !== '0'">{{dateFormat(o.updateDate)}}</span>
                        </div>

                        <div class="margin_top">
                          <span class="left_stl">备注：</span>
                          <span class="comment_style">{{o.remarks}}</span>
                        </div>
                      </el-col>
                      <el-col :span="5">
                        <el-button type="primary" icon="el-icon-view" @click="view(o)">查看</el-button>
                      </el-col>
                    </el-row>
                  </el-card>
                </el-col>
              </el-row>
            </div>
            <el-row v-if="achThesis<=0">
              <el-col :span="24" style="display: flex">
                <img src="../../assets/none.jpg" alt="" style="margin: 0 auto">
              </el-col>
            </el-row>
          </el-collapse-item>
          <el-collapse-item title="项目" name="2" v-if="achProjects.length!=0">
            <div v-for="(o ,index) in achProjects">
              <el-row class="a_margin_top">
                <el-col :span="24">
                  <div class="count">{{index+1}}</div><!--序号-->
                  <el-card shadow="hover" style="background-color: rgba(240,244,247,0.49);">
                    <el-row class="H_V_center">
                      <div class="state" v-if="o.state === '0'">未审核</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '1' && role < 2000 " style="background-color: #67C23A">
                        初审通过
                      </div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '1' && role >=2000 ">未审核</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '2'" style="background-color: red">复审通过</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '3'" style="background-color: red">通过</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '4'" style="background-color: #1b8fe5">退回</div><!--右上角三角状态-->
                      <el-col :span="19" style="margin: -10px 0px;">
                        <div class="margin_top">
                          <span class="title_style">标题：{{o.title}}</span>
                        </div>
                        <div class="margin_top">
                          <span class="left_stl">提交时间：</span>
                          <span class="time_style">{{dateFormat(o.createDate)}}</span>
                          <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                          <span class="left_stl" v-if="o.state !== '0'">审批时间：</span>
                          <span class="time_style" v-if="o.state !== '0'">{{dateFormat(o.updateDate)}}</span>
                        </div>
                        <div class="margin_top">
                          <span class="left_stl">备注：</span>
                          <span class="comment_style">{{o.remarks}}</span>
                        </div>
                      </el-col>
                      <el-col :span="5">
                        <el-button type="primary" icon="el-icon-view" @click="view(o)">查看</el-button>
                      </el-col>
                    </el-row>
                  </el-card>
                </el-col>
              </el-row>
            </div>
            <el-row v-if="achProjects<=0">
              <el-col :span="24" style="display: flex">
                <img src="../../assets/none.jpg" alt="" style="margin: 0 auto">
              </el-col>
            </el-row>
          </el-collapse-item>
          <el-collapse-item title="专利" name="3" v-if="achPatents.length!=0">
            <div v-for="(o ,index) in achPatents">
              <el-row class="a_margin_top">
                <el-col :span="24">
                  <div class="count">{{index+1}}</div><!--序号-->
                  <el-card shadow="hover" style="background-color: rgba(240,244,247,0.49);">
                    <el-row class="H_V_center">
                      <div class="state" v-if="o.state === '1' ">未审核</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '2'" style="background-color: red">初审通过</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '3'" style="background-color: red">通过</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '4'" style="background-color: #1b8fe5">退回</div><!--右上角三角状态-->
                      <el-col :span="19" style="margin: -10px 0px;">
                        <div class="margin_top">
                          <span class="title_style">标题：{{o.title}}</span>
                        </div>
                        <div class="margin_top">
                          <span class="left_stl">提交时间：</span>
                          <span class="time_style">{{dateFormat(o.createDate)}}</span>
                          <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                          <span class="left_stl">审批时间：</span>
                          <span class="time_style">{{dateFormat(o.updateDate)}}</span>
                        </div>
                        <div class="margin_top">
                          <span class="left_stl">发明人：</span>
                          <span class="comment_style">{{o.username}}</span>
                          <span class="left_stl" v-if="o.state !== '0'">审批时间：</span>
                          <span class="time_style" v-if="o.state !== '0'">{{dateFormat(o.updateDate)}}</span>
                        </div>
                        <div class="margin_top">
                          <span class="left_stl">备注：</span>
                          <span class="comment_style">{{o.body}}</span>
                        </div>
                      </el-col>
                      <el-col :span="5">
                        <el-button type="primary" icon="el-icon-view" @click="view(o)">查看</el-button>
                      </el-col>
                    </el-row>
                  </el-card>
                </el-col>
              </el-row>
            </div>
            <el-row v-if="achPatents<=0">
              <el-col :span="24" style="display: flex">
                <img src="../../assets/none.jpg" alt="" style="margin: 0 auto">
              </el-col>
            </el-row>
          </el-collapse-item>
          <el-collapse-item title="其他" name="4" v-if="achPatents.length!=0">
            <div v-for="(o ,index) in achPatents">
              <el-row class="a_margin_top">
                <el-col :span="24">
                  <div class="count">{{index+1}}</div><!--序号-->
                  <el-card shadow="hover" style="background-color: rgba(240,244,247,0.49);">
                    <el-row class="H_V_center">
                      <div class="state" v-if="o.state === '0'">未审核</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '1' && role < 2000 " style="background-color: #67C23A">
                        {{role}}
                      </div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '1' && role >=2000 ">未审核</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '2'" style="background-color: red">复审通过</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '3'" style="background-color: red">通过</div><!--右上角三角状态-->
                      <div class="state" v-if="o.state === '4'" style="background-color: #1b8fe5">退回</div><!--右上角三角状态-->
                      <el-col :span="19" style="margin: -10px 0px;">
                        <div class="margin_top">
                          <span class="title_style">论文标题：{{o.name}}</span>
                        </div>
                        <div class="margin_top">
                          <span class="left_stl">提交时间：</span>
                          <span class="time_style">{{dateFormat(o.createDate)}}</span>
                          <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                          <span class="left_stl">审批时间：</span>
                          <span class="time_style">{{dateFormat(o.updateDate)}}</span>
                        </div>
                        <div class="margin_top">
                          <span class="left_stl">备注：</span>
                          <span class="comment_style">{{o.body}}</span>
                        </div>

                      </el-col>
                      <el-col :span="5">
                        <el-button type="primary" icon="el-icon-view" @click="view(o)">查看</el-button>
                      </el-col>
                    </el-row>
                  </el-card>
                </el-col>
              </el-row>
            </div>
            <el-row v-if="achPatents<=0">
              <el-col :span="24" style="display: flex">
                <img src="../../assets/none.jpg" alt="" style="margin: 0 auto">
              </el-col>
            </el-row>
          </el-collapse-item>

        </el-collapse>
        <el-row v-if="achPatents.length<=0&&achProjects.length<=0&&achThesis.length<=0">
          <el-col :span="24" style="display: flex">
            <img src="../../assets/none.jpg" alt="" style="margin: 10px auto">
          </el-col>
        </el-row>


      </div>
      <div v-if="activeIndex === '2'">
        <el-table
          :data="examinetableDataPage"
          style="width: 100%;margin-top: 10px">
          <el-table-column type="expand">
            <template slot-scope="props">
              <el-form v-if="props.row.parenttype === '1'" label-position="left" inline class="demo-table-expand">
                <el-form-item label="标题">
                  <span>{{ props.row.title }}</span>
                </el-form-item>
                <el-form-item label="负责人">
                  <span>{{ props.row.username }}</span>
                </el-form-item>
                <el-form-item label="领域">
                  <span>{{ props.row.field }}</span>
                </el-form-item>
                <el-form-item label="领域">
                  <span>{{ props.row.grades}}</span>
                </el-form-item>
                <el-form-item label="类型">
                  <span>{{ props.row.typename }}</span>
                </el-form-item>
                <el-form-item label="备注">
                  <span>{{ props.row.remarks }}</span>
                </el-form-item>
                <el-form-item label="申请时间">
                  <span>{{ dateFormat(props.row.createDate) }}</span>
                </el-form-item>

              </el-form>
              <el-form v-if="props.row.parenttype === '2'" label-position="left" inline class="demo-table-expand">
                <el-form-item label="标题">
                  <span>{{ props.row.title }}</span>
                </el-form-item>
                <el-form-item label="负责人">
                  <span>{{ props.row.username }}</span>
                </el-form-item>
                <el-form-item label="领域">
                  <span>{{ props.row.field }}</span>
                </el-form-item>
                <el-form-item label="类型">
                  <span>{{ props.row.typename }}</span>
                </el-form-item>
                <el-form-item label="备注">
                  <span>{{ props.row.remarks }}</span>
                </el-form-item>
                <el-form-item label="申请时间">
                  <span>{{ dateFormat(props.row.createDate) }}</span>
                </el-form-item>

              </el-form>
              <el-form v-if="props.row.parenttype === '3'" label-position="left" inline class="demo-table-expand">
                <el-form-item label="标题">
                  <span>{{ props.row.title }}</span>
                </el-form-item>
                <el-form-item label="负责人">
                  <span>{{ props.row.username }}</span>
                </el-form-item>
                <el-form-item label="领域">
                  <span>{{ props.row.field }}</span>
                </el-form-item>
                <el-form-item label="专利申请日">
                  <span>{{ props.row.applydate }}</span>
                </el-form-item>
                <el-form-item label="类型">
                  <span>{{ props.row.typename }}</span>
                </el-form-item>
                <el-form-item label="备注">
                  <span>{{ props.row.remarks }}</span>
                </el-form-item>
                <el-form-item label="申请时间">
                  <span>{{ dateFormat(props.row.createDate) }}</span>
                </el-form-item>

              </el-form>
            </template>

          </el-table-column>
          <el-table-column
            type="index"
          >
          </el-table-column>
          <el-table-column
            label="标题"
            prop="title">
          </el-table-column>
          <el-table-column
            label="负责人"
            width="150"
            prop="username">
          </el-table-column>
          <el-table-column
            label="类型"
            width="100"
            prop="typename">
          </el-table-column>

          <el-table-column
            label="描述"
            prop="remarks">
          </el-table-column>

          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="primary"
                @click="chackach(scope)"
              >查看
              </el-button>
              <el-button
                size="mini"
                type="success"
                @click="Auditpass(scope)"
              >审核通过
              </el-button>
              <el-button
                size="mini"
                @click="reject(scope)"
                type="warning"
              >驳回
              </el-button>
            </template>
          </el-table-column>

        </el-table>


        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          style="text-align: right"
          :hide-on-single-page="true"
          :total="examinetableData.length"
          layout="prev, pager, next">
        </el-pagination>
      </div>

      <div v-if="activeIndex === '3'">
        <el-table
          :data="AuditedtableDataPage"
          style="width: 100%;margin-top: 10px">
          <el-table-column type="expand">
            <template slot-scope="props">
              <el-form v-if="props.row.parenttype === '1'" label-position="left" inline class="demo-table-expand">
                <el-form-item label="标题">
                  <span>{{ props.row.title }}</span>
                </el-form-item>
                <el-form-item label="负责人">
                  <span>{{ props.row.username }}</span>
                </el-form-item>
                <el-form-item label="领域">
                  <span>{{ props.row.field }}</span>
                </el-form-item>
                <el-form-item label="类型">
                  <span>{{ props.row.typename }}</span>
                </el-form-item>
                <el-form-item label="备注">
                  <span>{{ props.row.remarks }}</span>
                </el-form-item>
                <el-form-item label="申请时间">
                  <span>{{ dateFormat(props.row.createDate) }}</span>
                </el-form-item>

              </el-form>
              <el-form v-if="props.row.parenttype === '2'" label-position="left" inline class="demo-table-expand">
                <el-form-item label="标题">
                  <span>{{ props.row.title }}</span>
                </el-form-item>
                <el-form-item label="负责人">
                  <span>{{ props.row.username }}</span>
                </el-form-item>
                <el-form-item label="领域">
                  <span>{{ props.row.field }}</span>
                </el-form-item>
                <el-form-item label="类型">
                  <span>{{ props.row.typename }}</span>
                </el-form-item>
                <el-form-item label="备注">
                  <span>{{ props.row.remarks }}</span>
                </el-form-item>
                <el-form-item label="申请时间">
                  <span>{{ dateFormat(props.row.createDate) }}</span>
                </el-form-item>

              </el-form>
              <el-form v-if="props.row.parenttype === '3'" label-position="left" inline class="demo-table-expand">
                <el-form-item label="标题">
                  <span>{{ props.row.title }}</span>
                </el-form-item>
                <el-form-item label="负责人">
                  <span>{{ props.row.username }}</span>
                </el-form-item>
                <el-form-item label="领域">
                  <span>{{ props.row.field }}</span>
                </el-form-item>
                <el-form-item label="专利申请日">
                  <span>{{ props.row.applydate }}</span>
                </el-form-item>
                <el-form-item label="类型">
                  <span>{{ props.row.typename }}</span>
                </el-form-item>
                <el-form-item label="备注">
                  <span>{{ props.row.remarks }}</span>
                </el-form-item>
                <el-form-item label="申请时间">
                  <span>{{ dateFormat(props.row.createDate) }}</span>
                </el-form-item>

              </el-form>
            </template>

          </el-table-column>
          <el-table-column
            type="index"
          >
          </el-table-column>
          <el-table-column
            label="标题"
            prop="title">
          </el-table-column>
          <el-table-column
            label="负责人"
            width="150"
            prop="username">
          </el-table-column>
          <el-table-column
            label="类型"
            width="100"
            prop="typename">
          </el-table-column>
          <el-table-column
            label="描述"

            prop="remarks">
          </el-table-column>

          <el-table-column
            label="操作">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="primary"
                @click="viewpass(scope)"
              >查看
              </el-button>

            </template>
          </el-table-column>
          <el-table-column
            label="状态"
            :formatter="formatter"
            prop="state">
          </el-table-column>
        </el-table>

        <el-row v-if="AuditedtableDataPage.length<=0">
          <el-col :span="24" style="display: flex;margin-top: 10px">
            <img src="../../assets/none.jpg" alt="" style="margin: 0 auto">
          </el-col>
        </el-row>


        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          style="text-align: right"
          :hide-on-single-page="true"
          :total="AuditedtableData.length"
          layout="prev, pager, next">
        </el-pagination>

      </div>


    </el-main>
    <!-- <el-footer style="background-color: red">Footer</el-footer>-->
  </el-container>
</template>

<script>

    export default {
        name: "achievements",
        data() {
            return {
                role: this.$cookie.get("role"),
                examinetableData: [],
                examinetableDataPage: [],
                AuditedtableData: [],
                AuditedtableDataPage: [],
                loading: true,
                fullscreenLoading: false,
                activeIndex: '1',
                activeNames: "1",
                input: '',
                valu: 'ddd',
                title: '',
                time: "1999",
                achPatents: [],
                achProjects: [],
                achThesis: [],
                status: '',
                src: "../../assets/none.jpg"
            };
        },
        methods: {
            formatter(row, column) {
                console.log(row)
                var title = row.state == '1' ? '审核通过' : row.state == '2' ? '退回' : '提交上级'

                return title;

            },
            format(row) {

                var title = row.state == '1' ? '审核通过' : row.state == '2' ? '退回' : '审核中'

                return title;

            },
            dateFormat: function (date) {
                var time = this.UserInfo.dateFormat(date);
                return time;
            },
            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            handleCurrentChange(val) {
                this.examinetableDataPage = [];
                let pageLeng = val * 10
                var pagesize = this.examinetableData.length;

                if (val >= pagesize / 10)
                    pageLeng = pagesize
                for (let i = (val - 1) * 10; i < pageLeng; i++) {
                    this.examinetableDataPage.push(this.examinetableData[i])
                }

            },
            Auditpass(row) {
                var self = this;
                var state = "";
                if (this.role >= 2000 && this.role < 2500) {
                    if (row.row.grades + "" == "101") {
                        //班级成果   通过直接通过
                        state = "3";
                    } else {
                        //其他成果 多级审核
                        state = "1";
                    }

                } else if (this.role >= 2500 && this.role < 5000) {
                    //院长审核
                    if (row.row.grades + "" == "103") {
                        //院级成果   通过直接通过
                        state = "3";
                    } else {
                        //其他成果 多级审核
                        state = "2";
                    }

                } else {
                    state = "3"
                }

                this.$http.put(this.URL.api + "achievement/updateAchState/" + state + "/" + row.row.id + "/" + row.row.grades).then(res => {
                    if (res.data.flag) {

                        self.AuditedtableData.push(row.row);
                        if (self.AuditedtableData.length == 0 || self.AuditedtableData.length < 10) {
                            self.AuditedtableDataPage = self.AuditedtableData;

                        } else
                            for (let i = 0; i < 10; i++)
                                self.AuditedtableDataPage.push(self.AuditedtableData[i])

                        this.$message.success("审核成功")


                        for (let i = 0; i < self.examinetableDataPage.length; i++) {
                            if (row.row.id === self.examinetableDataPage[i].id) {
                                self.examinetableDataPage.splice(i, 1);
                            }
                        }
                        for (let j = 0; j < self.examinetableData.length; j++) {

                            if (row.row.id === self.examinetableData[j].id) {
                                self.examinetableData.splice(j, 1);

                                if ((parseInt(j / 10) + 1) * 10 - 1 < self.examinetableData.length) {
                                    console.log((parseInt(j / 10) + 1) * 10 - 1);
                                    console.log(self.examinetableData[(parseInt(j / 10) + 1) * 10 - 1])
                                    self.examinetableDataPage.push(self.examinetableData[(parseInt(j / 10) + 1) * 10 - 1])
                                }
                                return;
                            }
                        }


                    } else {
                        this.$message.error("审核失败")
                    }

                })


            },

            viewpass(row) {
                console.log(row)
                this.$router.push({
                    name: "CheckAch",
                    query: {
                        id: row.row.id,
                        pass: "1"

                    }
                })
            },
            reject(row) {
                var self = this;

                var state = "";
                if (this.role >= 2000 && this.role < 2500) {
                    if (row.row.grades + "" == "101") {
                        //班级成果   通过直接通过
                        state = "6";
                    } else {
                        //其他成果 多级审核
                        state = "4";
                    }

                } else if (this.role >= 2500 && this.role < 5000) {
                    //院长审核
                    if (row.row.grades + "" == "103") {
                        //院级成果   通过直接通过
                        state = "6";
                    } else {
                        //其他成果 多级审核
                        state = "5";
                    }

                } else {
                    state = "6"
                }


                this.$http.put(this.URL.api + "achievement/updateAchState/" + state + "/" + row.row.id + "/" + row.row.grades).then(res => {
                    if (res.data.flag) {


                        self.AuditedtableData.push(row.row);
                        if (self.AuditedtableData.length == 0 || self.AuditedtableData.length < 10) {
                            self.AuditedtableDataPage = self.AuditedtableData;

                        } else
                            for (let i = 0; i < 10; i++)
                                self.AuditedtableDataPage.push(self.AuditedtableData[i])

                        this.$message.error("退回成功")


                        for (let i = 0; i < self.examinetableDataPage.length; i++) {

                            if (row.row.id === self.examinetableDataPage[i].id) {
                                self.examinetableDataPage.splice(i, 1);

                            }
                        }
                        for (let j = 0; j < self.examinetableData.length; j++) {

                            if (row.row.id === self.examinetableData[j].id) {
                                self.examinetableData.splice(j, 1);
                                if ((parseInt(j / 10) + 1) * 10 - 1 < self.examinetableData.length) {
                                    console.log((parseInt(j / 10) + 1) * 10 - 1);
                                    console.log(self.examinetableData[(parseInt(j / 10) + 1) * 10 - 1])
                                    self.examinetableDataPage.push(self.examinetableData[(parseInt(j / 10) + 1) * 10 - 1])
                                }

                                return;
                            }


                        }


                    }

                })
            },
            handleSelect(key, keyPath) {
                this.activeIndex = key + "";
            },
            search() {//搜索
              var self = this;
              if (self.input==""){
                console.log("我进来了")
               this.getDataInfo();
                return;
              }
                console.log(this.input)
                this.loading = true;
              var id = this.$cookie.get("userid")

              this.$http.get(this.URL.api + "achievement/queryByAchwhereuid/" + self.input + "/" + id).then(res => {
                if (res.data.flag) {
              self.achThesis = res.data.data.achThesis
                  self.achProjects = res.data.data.achProject
                  self.achPatents = res.data.data.achPatent
                }

                self.getCD();


              })





            },
            view(o) {//查看
                console.log(o)
                this.$router.push({
                    name: 'AddAchievements', query: {
                        id: o.id,
                        parenttype: o.parenttype,
                        title: "编辑项目",

                    }
                });
            },
            add() {// 添加

                this.$router.push({path: '/student/index/AddAchievements', query: {}});
            },
          getCD() {
                this.loading = false;
            },
            search_value(str) {

            },
            inputRef: function () {

              this.input = this.$refs.name.value

            },
          getDataInfo(){


          //mounted　表示这个 Vue 对象加载成功了v
              var uid = this.$cookie.get("userid")
              var self = this;
              this.$http.get(this.URL.api + "achievement/queryByAchAllAndUid/" + uid).then(res => {
                if (res.data.flag) {
                  self.achThesis = res.data.data.achThesis
                  self.achProjects = res.data.data.achProjects
                  self.achPatents = res.data.data.achPatents
                }

              })

              this.getCD("?postId=4")

              //判断用于角色
              var roles = this.UserInfo.getUserRole();
              var role = roles[0].rname
              var college = self.UserInfo.getUserInfo().college
              if (role == 'dean' || role == 'subdecanal') {
                this.$http.get(this.URL.api + "achievement/queryAchByCollage/" + college).then(res => {
                  if (res.data.flag) {
                    console.log(res.data.data)
                    //  通过学院查询
                    self.examinetableData = res.data.data;
                    if (self.examinetableData.length == 0)
                      return;
                    for (let i = 0; i < 10; i++)
                      if (self.examinetableData[i] != null || self.examinetableData[i] != undefined)
                        self.examinetableDataPage.push(self.examinetableData[i])
                  }
                })

                //  查看已审核

                this.$http.get(this.URL.api + "achievement/queryAchByCollagepass/" + college).then(res => {
                  if (res.data.flag) {
                    if (res.data.data != null) {

                      //  通过学院查询
                      self.AuditedtableData = res.data.data;
                      if (self.AuditedtableData.length == 0 || self.AuditedtableData.length < 10) {
                        self.AuditedtableDataPage = self.AuditedtableData;
                        return;
                      }
                      for (let i = 0; i < 10; i++)
                        self.AuditedtableDataPage.push(self.AuditedtableData[i])


                    }
                  }

                })


              } else if (role == 'counselor') {
                this.$http.get(this.URL.api + "achievement/queryAchByclassAndTeacher/" + this.$cookie.get("userid")).then(res => {
                  if (res.data.flag) {

                    //  通过学院查询
                    self.examinetableData = res.data.data;
                    if (self.examinetableData.length == 0 || self.examinetableData.length < 10) {
                      self.examinetableDataPage = self.examinetableData
                      return;
                    }
                    for (let i = 0; i < 10; i++)
                      self.examinetableDataPage.push(self.examinetableData[i])
                  }

                });
                this.$http.get(this.URL.api + "achievement/queryAchByclassAndTeacherpass/" + this.$cookie.get("userid")).then(res => {
                  if (res.data.flag) {

                    //  通过学院查询
                    self.AuditedtableData = res.data.data;
                    if (self.AuditedtableData.length == 0 || self.AuditedtableData.length < 10) {
                      self.AuditedtableDataPage = self.AuditedtableData;
                      return;
                    }
                    for (let i = 0; i < 10; i++)
                      self.AuditedtableDataPage.push(self.AuditedtableData[i])


                  }

                })


              } else if (role === 'president') {

                this.$http.get(this.URL.api + "achievement/queryAchBySchool").then(res => {

                  if (res.data.flag) {
                    console.log(res.data.data)
                    //  通过学院查询
                    self.examinetableData = res.data.data;
                    if (self.examinetableData.length == 0)
                      return;
                    for (let i = 0; i < 10; i++)
                      if (self.examinetableData[i] != null || self.examinetableData[i] != undefined)
                        self.examinetableDataPage.push(self.examinetableData[i])
                  }

                })


                this.$http.get(this.URL.api + "achievement/queryAchBySchoolpass").then(res => {
                  if (res.data.flag) {

                    //  通过学院查询
                    self.AuditedtableData = res.data.data;
                    if (self.AuditedtableData.length == 0 || self.AuditedtableData.length < 10) {
                      self.AuditedtableDataPage = self.AuditedtableData;
                      return;
                    }
                    for (let i = 0; i < 10; i++)
                      self.AuditedtableDataPage.push(self.AuditedtableData[i])


                  }

                })

              }



          },

            chackach(id) {

                this.$router.push({
                    name: "CheckAch",
                    query: {
                        id: this.examinetableDataPage[id.$index].id,
                        parenttype: this.examinetableDataPage[id.$index].parenttype,
                    }
                })


            }

        },
        mounted: function () { //mounted　表示这个 Vue 对象加载成功了v

         this.getDataInfo();
        }
    }
</script>
